﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace PMngr.Data
{
    public class Unit
    {        
        public int Id { get; set; }
        [Required]
        public string Name { get; set; }
        public bool IsValid { get; set; }
        public string Address { get; set; }
        public string Contact { get; set; }
        public string ContactTel { get; set; }
        public DateTime CreateDate { get; set; }
        public string Description { get; set; }
        public int Capacity { get; set; }

        public virtual ItemBase UnitType { get; set; }
        // 自关联
        public virtual Unit ParentUnit { get; set; }
        public virtual ICollection<Unit> ChildUnits { get; set; }

        public Unit()
        {
            IsValid = true;
            CreateDate = DateTime.Now;
        }
    }

    #region Test
    //public class Person
    //{
    //    public int PersonId { get; set; }
    //    public string Name { get; set; }
    //    public Address Address { get; set; }

    //    public ICollection<Order> Orders { get; set; }
    //}

    //public class Address
    //{
    //    public string Street { get; set; }
    //    public string City { get; set; }
    //    public string State { get; set; }
    //    public string Zip { get; set; }
    //}

    //public class Order
    //{
    //    public int OrderId { get; set; }
    //    public DateTime OrderDate { get; set; }

    //    public Person Person { get; set; }
    //}
    #endregion

}
